// import Mock from "mockjs";

// Mock.mock("/api/getseckill", () => {
//   return Mock.mock({
//     code: 200,
// "data|5": [
//   {
//     "id|+1": 1,
//     name: "@cword(4,6)",
//     "img|1": [
//       "https://wpimg.wallstcn.com/e4558086-631c-425c-9430-56ffb46e70b3",
//       "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2202780618,895893289&fm=26&gp=0.jpg",
//       "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=360400461,2955275651&fm=26&gp=0.jpg",
//       "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1709216491,2536617744&fm=26&gp=0.jpg",
//       "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3036316726,676055399&fm=26&gp=0.jpg",
//       "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3623279689,206753714&fm=26&gp=0.jpg"
//     ],
//     flag: false,
//     timestamp: '@datetime("yyyy-MM-dd HH:mm:ss")',
//     time: '@datetime("HH:mm-HH:mm")'
//   }
// ]
//   });
// });

const Mock = require("mockjs");

const data = Mock.mock({
    "list|50-100": [{
        "id|+1": 1,
        name: "@cword(4,6)",
        price: "@integer(300, 500)",
        names: "@cword(30,35)",
        bottom: "@integer(100, 299)",
        people: "@integer(1, 100)",
        help: "@integer(1, 100)",
        success: "@integer(1, 100)",
        limit: "@integer(1, 100)",
        surplus: "@integer(1, 100)",
        "img|1": [
            "https://wpimg.wallstcn.com/e4558086-631c-425c-9430-56ffb46e70b3",
            "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2202780618,895893289&fm=26&gp=0.jpg",
            "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=360400461,2955275651&fm=26&gp=0.jpg",
            "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1709216491,2536617744&fm=26&gp=0.jpg",
            "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3036316726,676055399&fm=26&gp=0.jpg",
            "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3623279689,206753714&fm=26&gp=0.jpg"
        ],
        flag: false,
        timestamp: '@datetime("yyyy-MM-dd HH:mm:ss")',
        time: '@datetime("HH:mm-HH:mm")'
    }]
});

module.exports = [{
    url: "/vue-element-admin/seckill",
    type: "post",
    response: res => {
        const { pageIndex, pageSize } = res.body;
        // console.log("res", res.body, pageIndex, pageSize);
        // 分页功能
        const list = data.list.slice(
            (pageIndex - 1) * pageSize,
            pageSize * pageIndex
        );
        return {
            code: 20000,
            data: list,
            total: data.list.length
        };
    }
}];
